﻿<%@ Page Title="" Language="C#"MasterPageFile="~/Areas/Admin/Views/Shared/MainContent.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="fullBox">
  <div class="tabListBoxHead">
    <div style="float: left; padding-top: 3px;">                 
                <img src="/Content/add.png" width="16" height="16" border="0" align="absmiddle" style="margin-right: 3px;" />
                <%: Html.ActionLink("创建部门", "Edit") %>
    </div>
    <div style="float: right;">
               
    </div>
  </div>

    <div class="tabListBox">
    <table id="ETList" cellpadding="0" cellspacing="0">
	<thead>
        <tr>
           
            <th>
                部门名称
            </th>
             <th>
                上级部门名称
            </th>
            <th>
                部门介绍
            </th> <th>操作</th>
            
            
        </tr>
    </thead>
	<tbody>
    <% foreach (var item in ViewData["departments"] as HashSet<MShop.Core.Domain.Department>)
       { %>
    
          <tr <%if(!item.IsRoot)Response.Write("class='"+item.TableRowClass+"'"); %> id='<%=item.TableRowId %>'>
            
           
         
            <td>
                <%: item.DeptName %>
            </td>   <td>
                <%: item.ParentId.HasValue?item.Department2.DeptName:"" %>
            </td>
            <td>
                <%: item.DeptMemo %>
            </td>
            <td>
                <%: Html.ActionLink("编辑", "Edit", new { id=item.Id }) %>  
                <% if (item.HasChild == false)
                   { %>   
                    <% if (item.Id != 10 && item.Id != 6)
                       { %>         
                | <%: Html.ActionLink("删除", "Delete", new { id = item.Id }, new { @onclick = "return confirm('确认删除该部门？');" })%>
                <%} %>
                <%} %>
            </td>
        </tr>
    
    <% } %>
   </tbody>
    </table>
	</div>
  
</div>
   

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="cphMeta" runat="server">
<script type="text/javascript">
        $(document).ready(function () {
            var windowWidth = $("#fullBox").width();
            var windowHeight = $("#fullBox").height() - 30;
            $('.tabListBox').css({ 'width': windowWidth + 'px', 'height': windowHeight + 'px' });
            $(window).resize(function () {
                var windowWidth = $("#fullBox").width();
                var windowHeight = $("#fullBox").height() - 30;
                $('.tabListBox').css({ 'width': windowWidth + 'px', 'height': windowHeight + 'px' });
            });
            $('.tabListBox').fixedHeaderTable({ footer: false, cloneHeaderToFooter: false, autoResize: true, fixCol1: true });

            $('.tabListBox').find("tbody").find("tr").each(function (i) {
                if (i % 2 == 1) {
                    $(this).find("td").addClass("tr1");
                }
            });
            $('.tabListBox').find("tbody").find("tr").mouseover(function (i) {
                $(this).find("td").addClass("tr0");
            });
            $('.tabListBox').find("tbody").find("tr").mouseout(function (i) {
                $(this).find("td").removeClass("tr0");
            });

        });
    </script>

     <script type="text/javascript" src="/js/treeTable/javascripts/jquery.treeTable.js"></script>
    <link href="/js/treeTable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />

     <script type="text/javascript">
         $(document).ready(function () {
             $("#ETList").treeTable({
                 childPrefix: "child-of-",
                 clickableNodeNames: false, expandable: false, indent: 19, initialState: "collapsed", treeColumn: 0
             });
         });
    </script>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="cphFooter" runat="server">
</asp:Content>

